package net.lab1024.sa.admin.module.business.erp.controller;

import net.lab1024.sa.admin.module.business.erp.domain.form.add.MmordaAddForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.query.MmordaQueryForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.query.MmordbQueryForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.update.MmordaUpdateForm;
import net.lab1024.sa.admin.module.business.erp.domain.vo.MmordaVO;
import net.lab1024.sa.admin.module.business.erp.service.MmordaService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 生产订单与机器对应表 Controller
 *
 * @Author AKITA
 * @Date 2025-04-19 12:46:38
 * @Copyright AKITA
 */

@RestController
@Tag(name = "生产订单与机器对应表")
public class MmordaController {

    @Resource
    private MmordaService mmordaService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/mmorda/queryPage")
    public ResponseDTO<PageResult<MmordaVO>> queryPage(@RequestBody @Valid MmordaQueryForm queryForm) {
        return ResponseDTO.ok(mmordaService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/mmorda/add")

    public ResponseDTO<String> add(@RequestBody @Valid MmordaAddForm addForm) {
        return mmordaService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/mmorda/update")

    public ResponseDTO<String> update(@RequestBody @Valid MmordaUpdateForm updateForm) {
        return mmordaService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/mmorda/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return mmordaService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/mmorda/delete/{docEntry}")

    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return mmordaService.delete(docEntry);
    }

    @PostMapping("/mmorda/deleteLine")
    public ResponseDTO<String> deleteLine(@RequestBody MmordbQueryForm queryForm) {
        return mmordaService.deleteLine(queryForm);
    }
}
